﻿@using PagedList.Mvc
@model MyWorkBlogMVC.Models.PostWithContentModel
@{
    ViewBag.Title = "PostWithContent";
}
@Styles.Render("~/Content/css")
<link href="~/Content/PageContent.css" rel="stylesheet" />
<div class="jumbotron">
    <img src="~/Content/blogme.PNG" />
</div>

<div class="body_wrapper">

    <div class="postContent">
        <h1>@Model.BlogPosts.PostTitle</h1>
        @Model.BlogPosts.PostContent
    </div>
    <div class="modifyDiv">
        @if (Model.BlogPosts.LastModifyDate != Model.BlogPosts.PostDate)
        {
            <text> Modified:</text>
            @Model.BlogPosts.LastModifyDate
        }
    </div>
    @using (Html.BeginForm())
    {
        @Html.ValidationSummary(true, "it must not exceed the 200 characters")
        <div class="editor">

            <div>
                @Html.LabelFor(m => m.CommentContent)
                @Html.TextAreaFor(m => m.CommentContent)
                @Html.ValidationMessageFor(m => m.CommentContent)
            </div>

            <div>
                @Html.LabelFor(m => m.Email)
                @Html.TextBoxFor(m => m.Email)
                @Html.ValidationMessageFor(m => m.Email)
            </div>

            <div>
                @Html.LabelFor(m => m.NameOfCommetor)
                @Html.TextBoxFor(m => m.NameOfCommetor)
            </div>
            <div>
                <input type="submit" value="Comment" />
            </div>


        </div>
    }
    @*@Html.Partial("~/Views/Shared/_Comment.cshtml")*@


    <div>

        @foreach (var c in Model.PostComments)
        {
            <ul>
                <li>
                    <div class="commentDate"> Commented:<br/>
                     @c.CommentDate.ToString("D")</div>
                    <div class="blogInfo">

                        <div class="commentContent">
                            @c.CommentContent
                            <hr />
                            <div>
                                Comment by: @c.NameOfCommetor
                            </div>
                            <div>
                                Email: @c.Email
                            </div>


                        </div>
                    </div>
                </li>
            </ul>
        }
@Html.PagedListPager(@Model.PostComments, page=>Url.Action("PostWithContent", new{page}))
    </div>
</div>